﻿
@{
    Layout = "";
}
<div class="w_loanDetail" ng-controller="ProductExchangeDetailCtrl">
    <div class="w_excdtl_menu">
        <ul class="w_excdtlMenu_ul">
            <li class="w_exmenu_default"><a>商品</a></li>
            <li><a>详情</a></li>
        </ul>
    </div>
    <!--商品-->
    <div class="w_excdetil_allpro w_change">
        <!-- 轮播图 -->
        <div>
            <carousel interval="myInterval">
                <slide ng-repeat="slide in slides" active="slide.active">
                    <img ng-src="{{slide.image}}" style="margin: auto;" alt="" />
                </slide>
            </carousel>
        </div>
        <!-- 轮播图结束 -->
        <div class="w_jfdhxq_top">
            <div class="w_jfdhxq_topName">{{Product.Name}}</div>
            <p class="w_jfdhxq_topPost">{{Product.Description}}</p>
            <div class="w_jfdhxq_topbot w_jfdhxq_bbbb">
                <!--<font color="#eb272a">2000积分</font>-->
                <div class="w_jfdhxq_aaaa">
                    <font color="#eb272a">{{Product.Points}}积分</font>
                    <div>{{Product.LevelLimitText}}</div>
                </div>
                <p>库存：{{Product.Stock}}</p>
            </div>
        </div>
        <!--底部-->
        <div class="w_jfxqbot_fixed">
            <font color="#eb272a" class="w_jfxqbot_left">{{Product.Points}}积分</font>
            <span class="w_jfxqbot_right" ng-click="Buy()">立即兑换</span>
        </div>
    </div>
    <!--商品-->
    <!--详情-->
    <div class="w_excdetil_detail w_change" style="display:none;">
        <div ng-bind-html="Product.Detail|to_trusted" id="detail"></div>
    </div>
    <!--详情-->
</div>

<script type="text/javascript">
    App.controller('ProductExchangeDetailCtrl', [
            '$scope', '$http', '$rootScope', '$stateParams', '$state', '$timeout',
        function ($scope, $http, $rootScope, $stateParams, $state, $timeout) {

            //数据初始化
            $http.post("/Product/ProductExchangeDetail", { Id: $stateParams.Id }).then(function (response) {
                if (!response.data) {
                    $state.go("message", { msg: "该商品已下架或不存在" }, { location: 'replace' });
                    return;
                }
                $scope.Product = response.data;

             
                var tt = function () {
                    $rootScope.WxShare($scope.ShareTittle, $scope.ShareContent, location.href, $rootScope.ImgHostUrl + $scope.ShareImg);

                    $("#detail").find("img").css("width", "")
                }

                setTimeout(tt, 1000)

                // 设置轮播图图片间隔
                $scope.myInterval = 3000;
                // 轮播图数据初始化
                var slides = $scope.slides = [];
                // 添加轮播图源
                slides.push({ image: $rootScope.ImgHostUrl + $scope.Product.ImgUrl });
                if ($scope.Product.SubImgUrls.length > 0) {
                    angular.forEach($scope.Product.SubImgUrls, function (imgurl) {
                        slides.push({ image: $rootScope.ImgHostUrl + imgurl });
                    });
                }


            });



            

            //立即购买
            $scope.Buy = function () {
                if (!$scope.Product.CanExchange) {
                    layer.msg($scope.Product.LevelLimitText);
                } else {
                    $state.go("shop.pointorder", {  id: $scope.Product.Id});
                }
            }




        }]);
</script>
<script type="text/javascript">
    $(".w_excdtlMenu_ul li").click(function () {
        var index = $(this).index();
        $(".w_excdtlMenu_ul li").removeClass("w_exmenu_default");
        $(this).addClass("w_exmenu_default");
        $(".w_change").hide();
        $(".w_change").eq(index).show();
    });

    $(".w_qgxq_collect").click(function () {
        $(this).hide();
        $(".w_qgxq_collected").show();
    });
    $(".w_qgxq_collected").click(function () {
        $(this).hide();
        $(".w_qgxq_collect").show();
    });
    var h = $(document).height();
    $(function () {
        $(".w_qgxqBot_b ").click(function () {
            $(".f_popBox").show();
            $(".f_popBox").css("height", h);
            $(".hideGZ").show();
            $(".w_jfxqbot_fixed").hide();
        });
        $(".w_qgxqBot_c ").click(function () {
            $(".f_popBox").show();
            $(".f_popBox").css("height", h);
            $(".hideGZ").show();
            $(".w_jfxqbot_fixed").hide();
        });
        $(".w_jfdhxq_property ").click(function () {
            $(".f_popBox").show();
            $(".f_popBox").css("height", h);
            $(".hideGZ").show();
            $(".w_jfxqbot_fixed").hide();
        });
        $(".fclose ").click(function () {
            $(".f_popBox").hide();
            $(".f_popBox").css("height", h);
            $(".hideGZ").hide();
            $(".w_jfxqbot_fixed").show();
        });
    })


    

</script>
